//
//  TopListCollectionViewCell.m
//  艾听歌
//
//  Created by dllo on 16/5/16.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "TopListCollectionViewCell.h"

@implementation TopListCollectionViewCell
//初始化
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        //图片
        self.imageView = [[UIImageView alloc] init];
//        self.imageView.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:self.imageView];
        //标题
        self.titleLable = [[UILabel alloc] init];
//        _titleLable.backgroundColor = [UIColor purpleColor];
        [self.contentView addSubview:self.titleLable];
        
        self.playButton = [[UIButton alloc] init];
        //        self.playButton.backgroundColor = [UIColor redColor];
        [self.imageView addSubview:self.playButton];
    }
    return self;
}

//布局方法
-(void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes{
    [super applyLayoutAttributes:layoutAttributes];
    self.imageView.frame = CGRectMake(0, 0, layoutAttributes.size.width, layoutAttributes.size.height - 30);
    
    self.titleLable.frame = CGRectMake(0, self.imageView.frame.size.height, self.imageView.frame.size.width, 30 * fitHeight);
    
    self.playButton.frame = CGRectMake(self.imageView.frame.origin.x + 85, self.imageView.frame.origin.y + 75, 20 * FitWidth, 20 * fitHeight);
    [self.playButton setBackgroundImage:[UIImage imageNamed:@"播放"] forState:UIControlStateNormal];
    [self.playButton setTintColor:[UIColor whiteColor]];

    
    
}

- (void)setNewCellModel:(MusicSmallModel *)NewCellModel
{
    _NewCellModel = NewCellModel;
//    self.intrLabel.text = [NSString stringWithFormat:@"%@",_NewCellModel.name];
    self.titleLable.text = [NSString stringWithFormat:@"%@",_NewCellModel.desc];
    NSURL *url = [NSURL URLWithString:_NewCellModel.picUrl];
    [self.imageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"hold.png"]];
}


@end
